The invention relates to industrial controllers for use in controlling industrial processes, and in particular to an integrated circuit processor for use in such industrial controllers and capable of executing both a reduced instruction set of general purpose arithmetic and logical instructions and specialized relay ladder language instructions with one set of architectural components including the program counter, registers and data lines.
Industrial controllers are special purpose computers used for controlling an industrial process, such as an assembly line, in real-time in accordance with a stored program. Under the direction of a stored program, the industrial controller examines a series of inputs reflecting the status of the industrial process and changes a series of outputs controlling the industrial process.
Industrial controllers are typically programmed in a "relay ladder" language. This language, which has became an accepted standard in industry, employs instructions represented by "contacts" and "coils" of virtual relays connected in ladder like "rungs". A relatively small number of basic ladder logic instructions allows the construction of complex control programs. The core instructions include XIC ("examine if closed"), XIO ("examine if open"), and OTE ("output enable"). The former two instructions check the state of a binary input and are graphically represented by either normally open or normally closed contacts in the relay ladder diagram. The latter instruction identifies the state of an output and is graphically represented by a coil. Other "coil" instructions include the OTL instruction ("output latch") and OTU ("output unlatch").
Each of these "contact" instructions reads a bit in memory which may represent the state of a physical signal in the industrial process as updated by I/O circuitry and according to the logic of the instruction (e.g., XIC or XIO) sets or resets a "rung flag" as the rung is traversed. Depending on the topology of the rung when a coil instruction is reached at the end of the rung, the state of the rung flag indicates whether the output should be enabled or not. The "coil" instruction outputs this state to another bit in memory as may be communicated to the controlled process by the I/O circuitry.
In a common relay ladder program, a specialized processor will read each of the rungs (composed of contacts and coils) in sequence to examine contacts and to generate an output via the coil. Each rung is executed in a consistent order at high speed until the completion of all rungs. Then there may be a period of refreshing of the I/O data, and the rungs will again be executed. High speed execution of the rungs provides the appearance that they execute in parallel as would be the case with true relays and as is essential to the fundamental operation of any real-time control program. A delay or unpredictability in the execution of the control program may have a detrimental effect on the industrial process either causing it to fail or to run erratically. Relay ladder instructions may be executed quickly on simple hardware and provide an intuitive language for control processes.
With the increasing overlap between the technologies of industrial controllers and conventional computers, industrial controllers have been designed to execute arithmetic and logical instructions normally reserved for conventional computers. These instructions include for example, addition, subtraction, multiplication and Boolean instructions such as AND, OR and XOR as well as branching instructions for the generation of loops and the like. Some of these instructions, such as the Boolean instructions, are redundant with relay ladder instruction, that is, they offer no new capability for the controller but simply a choice of instructions.
One way to provide a controller that may execute both computer-like and relay ladder instructions is through the use of a conventional micro-processor and special software simulating the relay ladder instructions through the use of conventional arithmetic and logic instructions. These machines are often known as "soft PLCs" reflecting the fact that they perform some of the tasks normally associated with a programmable logic controller (an industrial controller). The soft PLC approach has the disadvantage that it is relatively slow in its execution of relay ladder logic instructions because of the necessary interpretation of these instructions into arithmetic and logical instructions general microprocessors and because of their lack of specialized hardware which may take advantage of the natural efficiencies of relay ladder language programming.
A preferred approach to providing computer-like instructions in an industrial controller is through the use of two processors, one dedicated to relay ladder processing and the other to general purpose arithmetic and logical instructions. In such a machine, one processor acts as a co-processor to the other with the task of executing the control program being passed off to the machine capable of executing the particular instruction at hand. This use of both a general purpose processor and a specialized relay language processor operating together to execute a control program is described in U.S. patent Ser. No. 08/154,232 filed Nov. 18, 1993 and entitled: "High Speed Relay Language Processor" assigned to the assignee of the present invention and hereby incorporated by reference. In this patent, a co-processor relationship is described where the relay language processor may transfer control for a number of instructions to a general purpose processor. The general purpose processor, upon completion of its assigned instructions, returns control to the relay language processor. Because the preponderance of instructions of a real-time control program will be in relay ladder instructions, the general purpose processor is run as a co-processor subservient to the relay language processor.
This dual processor approach is not without its problems, the most notable of which is the time required to transfer responsibility for executing the control program between two machines. In U.S. Ser. No. 08/762,650 filed Dec. 9, 1996 and entitled: Bi-Directional Co-Processor Interface" this problem is addressed by the use of a shared stack. Variables needed for the execution of the program may be placed in the stack to be used by either of the two processors eliminating the time consuming process of transferring these variables back and forth between the registers of two machines. This patent also is assigned to the assignee of the present invention and hereby incorporated by reference.
It would be desirable to provide a means of executing both general purpose computer arithmetic and logical instructions and relay ladder instructions with minimized overhead in transferring control between two machines while allowing high speed processing of relay ladder instructions as requires dedicated hardware.